feat(image-editor): wire Blur tool — drag a rect to blur a region#41
Merged
feat(image-editor): wire Blur tool — drag a rect to blur a region#41
Conversation
Promotes the Blur tool from stub to functional. Drag a rectangle on the canvas; the area inside is blurred at render time using the canvas \`filter: blur(Npx)\` primitive. Modeled after the Mosaic tool — same "sample the underlying composite, draw it back in place" pattern, just with a Gaussian blur instead of pixelation. ## Implementation - New \`BlurShape\` (kind: 'blur') with x/y/w/h + radius (default 8 px, preview-pixel space). Joins the \`Shape\` union; round-trips through serialize/parse via the existing image-shape forwards-compat path. - \`drawing.ts\` gets \`drawBlurRegion\`: \`ctx.filter = blur(r * scale)\`, then \`drawImage(underlying, src, dst)\` of the rect onto itself. Scale applies to the radius so blur looks consistent across preview and export. - \`render.ts\` snapshots the canvas before any mosaic OR blur layer (the underlying-canvas read is the same need for both). - \`hit.ts\` + \`transform.ts\`: blur falls into the rect-corner-handle case, so move + resize "just work" via the existing pattern. - \`Canvas.tsx\`: tool 'blur' starts a rect-style drag like mosaic; default radius bakes into the new shape. - \`OptionsBar\`: blur shares the simple-hint variant with mosaic/mask. - \`ToolsPalette\`: new entry next to Mosaic in the Annotation group (Aperture icon). - \`LayersPanel\`: \`annoLabel.blur\` for the layer list. Removes \`blur\` from \`STUB_TOOLS\`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Promotes the Blur tool from stub to functional. Drag a rectangle on the
canvas; the area inside is blurred at render time using the canvas
`filter: blur(Npx)` primitive.
Modeled after the Mosaic tool — same "sample the underlying composite,
draw it back in place" pattern, just with a Gaussian blur instead of
pixelation. Cheap, non-destructive, undoable.
Implementation
preview-pixel space). Joins the `Shape` union; round-trips through
serialize/parse via the existing forwards-compat path.
then `drawImage(underlying, src, dst)` of the rect onto itself. Scale
applies to the radius so blur looks consistent across preview and
export.
underlying-canvas-read need).
case, so move + resize "just work" via the existing pattern.
(Aperture icon).
Removes `blur` from `STUB_TOOLS`.
Test plan
🤖 Generated with Claude Code